<template>
  <div>
    <video id="videoElement" controls autoplay muted width="650px" height="350px">
    </video>
<!--    <button @click="play">播放</button>-->
  </div>
</template>
<script>
import flvjs from 'flv.js'
export default {
  data () {
    return {
      flvPlayer:null
    }
  },
  mounted() {
    if (flvjs.isSupported()) {
      var videoElement = document.getElementById('videoElement');
      this.flvPlayer = flvjs.createPlayer({
        type: 'flv',
        isLive: true,
        hasAudio: false,
        url: 'http://81.70.44.28/flv?port=1945&app=live2'
      });
      this.flvPlayer.attachMediaElement(videoElement);
      this.flvPlayer.load();
      this.flvPlayer.play();
    }
  },
  methods:{
    play () {
      this.flvPlayer.play();
    }
  },
}
</script>
